New to native iOS app testing? No worry, you don’t need to know much to set it up. Let's get your first native iOS app test up and running in a couple of minutes.
$ npm --version
# If not, install npm3
$ npm install -g npm@3
# Create a workspace and get the smaple code
$ git clone git@github.com:TestArmada/boilerplate-nightwatch.git
$ cd boilerplate-nightwatch
$ npm install
$ npm install appium@1.7.2
$ npm install wd
# install appium-doctor (may require sudo)
$ npm install appium-doctor -g
# check that all iOS dependencies are set up correctly
$ appium-doctor --ios
./app
folder, for example rename .app and put it as ./app/AUT.app
.nightwatch.json
"appiumiosapp": {
"skip_testcases_on_fail": true,
"desiredCapabilities": {
"app": "./app/AUT.app",
"appiumVersion": "1.7.2",
"automationName": "XCUITest",
"platformName": "iOS",
"platformVersion": "11.2",
"deviceName": "iPhone 8",
"waitForAppScript": "true",
"browserName": ""
},
"selenium": {
"start_process": false
},
"appium": {
"start_process": true,
"fullReset": true
}
}
app.test.js
under ./tests
folder, it can be as simple as followingvar Test = require("testarmada-nightwatch-extra/lib/base-test-class");
module.exports = new Test({
"Load demo page": function (client) {
console.log('yeah');
}
});
./node_modules/.bin/magellan --config magellan.json --local_browser appiumiosapp --test tests/app.test.js --serial --max_test_attempts 1
You should see iOS simulator open, your app open, close and simulator close.
"testarmada-magellan-saucelabs-executor"